<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="password" class="password">
    <main>
        <span>1</span>
        <span>2</span>
        <span>3</span>
    </main>
    <span>1</span>
    <span>2</span>
    <span>3</span>
    
</body>
<script>
    let input = document.querySelector(".password")
    input.addEventListener("keyup", (e)=>{
        let value = e.target.value;
        const regs = [
            /^[a-z\d]{5,10}$/i,
            /[A-Z]/
        ]
        let start = regs.every(e=>e.test(value))
        // console.log(regs);
        if (!start) {
            console.log("密码必须由5-10位字母数字组合,切必须有一个大写字母");
        }else{
            console.log("密码格式正确");
        }
    })




    let main = document.querySelector("main")
    const reg = /<span>([\s\S]+?)<\/span>/gi
        console.log(reg);
    main.innerHTML = main.innerHTML.replace(reg, (e, p1)=>{
        console.log(e);
        return `<h4 style = "color:red"> g-${p1}<\/4>`
    })

    const body = document.body;
    console.log(body);

    let hd = body.innerHTML.matchAll(reg)
    let content = []
    for (const i of hd) {
        content.push(i[1])
    }
    console.log(content);

    const regexp = /(t)(e)(s)(t(\d?))/g;
    const str = 'test1test2';
    console.log(...str.matchAll(regexp));

</script>
</html>